CXX=mpic++

# Define source files, objects, and target executable.
SRC=$(wildcard *.cpp */*.cpp */*/*.cpp)
OBJ=$(SRC:.cpp=.o)
EXE=pxfem

all: CFLAGS+=-O2
all: $(SRC) $(EXE)

debug: CFLAGS+=-g -ggdb
debug: LFLAGS+=-g
debug: $(SRC) $(EXE) 

profile: CFLAGS+=-c -O2 -pg
profile: LFLAGS+=-pg
profile: $(SRC) $(EXE) 


$(EXE): $(OBJ)
	$(CXX) $(OBJ) $(LFLAGS) -o $@

.cpp.o:
	$(CXX) -c -std=c++0x $(CFLAGS) $< -o $@

clean:
	@rm -f $(OBJ)
